#include <iostream>
#include <memory>
#include "jsoncpp/json/json.h"
using namespace std;
int main()
{
    const char *name = "小明";
    int age = 18;
    float score[] = {88.5, 98, 58};
    Json::Value val;
    val["姓名"] = name;
    val["年龄"] = age;
    val["成绩"].append(score[0]);
    val["成绩"].append(score[1]);
    val["成绩"].append(score[2]);
    Json::StreamWriterBuilder swb;
    std::unique_ptr<Json::StreamWriter> sw(swb.newStreamWriter());
    std::ostringstream os;
    sw->write(val, &os);
    std::string str = os.str();
    std::cout << str << std::endl;
    return 0;
}